package com.vic.test.designpattern._2proxypattern.dynamicproxy;


import com.vic.test.designpattern._2proxypattern.UserDao;
import com.vic.test.designpattern._2proxypattern.IUser;

public class APP {
    public static void main(String[] args) {
        //目标对象
        IUser target = new UserDao();

        //原始对象的类型
        System.out.println(target.getClass());

        //给目标对象创建代理对象
        IUser proxy = (IUser) new ProxyFactory(target).getProxyInstance();
        //查看代理对象的类型
        System.out.println(proxy.getClass());
        //执行目标方法
        proxy.save();
    }
}
